<template>
  <div class='gameArea'>
    <div class='bpx_btn' style='cursor:pointer'><img src="../../static/image/bpx_game.png" alt="" @click="changePage('bpx')">
    </div>
    <div class='usdt_btn' style='cursor:pointer'>
      <img src="../../static/image/usdt_game.png" alt="" @click="changePage('ustd')">
    </div>
    <div class='bpxHidden'>
       <span>BPX区：</span>
       <p>本区域为BPX区，BPX为布勒旗下一款数字货币，可通过BPX来进行游戏。</p>
    </div>
    <div class='usdtHidden'>
       <span>USDT区：</span>
       <p>本区域为USDT区，USDT为一款数字货币，可通过USDT来进行游戏。</p>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      alchemyIsOpen: 1,
      ginsenIsOpen: 1,
      flag: false
    };
  },
  mounted() {
    this.$parent.flag1 = false;
    this.$parent.flag2 = false;
  },
  methods: {
    changePage(d) {
      u.coinType(data => {
        if (data && data[0].code == "200") {
          let id;
          if (d === "bpx") {
            data[0].data.some(el => {
              el.type === "BPX" ? (id = el.id) : "";
            });
            localStorage.setItem("cointype", id);
          } else if (d === "ustd") {
            data[0].data.some(el => {
              el.type == "USDT" ? (id = el.id) : "";
            });
            localStorage.setItem("cointype", id);
          }
          u.coinTypetax({ id: id }, data => {
            if (data && data[0].code == "200") {
              localStorage.setItem("exchange", JSON.stringify(data[0].data));
              data[0].data.bitype = "矿石";
              u.setStore("winning", data[0].data);
              u.setStore(
                "mount",
                data[0].data.seeds_amount * data[0].data.gold +
                  data[0].data.silver_seeds_amount * data[0].data.silver +
                  data[0].data.copper_seeds_amount * data[0].data.copper
              );
              u.isPlay(data => {
                if (data && data[0].code == 200) {
                  this.alchemyIsOpen = data[0].data.alchemyIsOpen;
                  this.ginsenIsOpen = data[0].data.ginsenIsOpen;
                  this.flag = true;
                }
                if (this.$route.params.id == 1) {
                  switch (parseInt(this.alchemyIsOpen)) {
                    case 0:
                      // alert("游戏暂时未开放");
                      this.$parent.loading({
                        message: "游戏暂时未开放",
                        type: false
                      });
                      break;
                    case 1:
                      this.$router.push({ path: "/seed/2" });
                      break;
                    case 2:
                      // alert("游戏正在维护");
                      this.$parent.loading({
                        message: "游戏正在维护",
                        type: false
                      });
                      break;
                  }
                } else {
                  switch (parseInt(this.ginsenIsOpen)) {
                    case 0:
                      // alert("游戏暂时未开放");
                      this.$parent.loading({
                        message: "游戏暂时未开放",
                        type: false
                      });
                      break;
                    case 1:
                      this.$router.push({ path: "/indexstart" });
                      break;
                    case 2:
                      // alert("游戏正在维护");
                      this.$parent.loading({
                        message: "游戏正在维护",
                        type: false
                      });
                      break;
                  }
                }
              });
            }
          });
        }
      });
    }
  }
};
</script>

<style lang='less' scoped>
.gameArea {
  background-image: url(../../static/image/ginsengbg2.png);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background-size: 100% 100%;
  .bpx_btn {
    position: fixed;
    left: 50%;
    top: 45%;
    transform: translate(-50%, -50%);
  }
  .usdt_btn {
    position: fixed;
    left: 50%;
    top: 55%;
    transform: translate(-50%, -50%);
  }
   .bpxHidden,.usdtHidden{
    width: 311px;
    height: 202px;
    background-image: url('../../static/image/borderOpacity.png');
    background-size: 100% 100%;
    position: absolute;
    bottom: 59%;
    left: 30%;
    padding: 26px 26px;
    span {
      font-size:22px;
      color : #7f5200;
      font-family:"MicrosoftYaHei"; 
      font-weight:bold;
    }
    p{
      font-size:20px;
      color : #7f5200;
      font-family:"MicrosoftYaHei";
      line-height: 36px; 
    }
  }
  .usdtHidden{
    background-image: url('../../static/image/borderOpacity1.png')!important;
    bottom: 26%!important;
  }
}
</style>

